The SixBit Application Programming Interface
Viewing the Source

The Sample Application is a Visual Studio 2013 Visual Basic .Net application.  Visual Studio is required to open and view it.

Loading the Sample Application

The sample application is provided as a zip file (SixBit.API-SampleApplication.zip) in the SixBit API SDK folder of the SixBit installed directory.  Unzip the application to a folder on your hard drive.  The contents will include a SixBit.API-SampleApplication folder and the SixBit.API-SampleApplication solution file.  Double-click the solution file to open it in Visual Studio.

 

 

As mentioned previously, any app that uses the SixBit API must reference several files from the SixBit installed directory.  To add the references, open the properties of the SixBit.API-SampleApplication project and click on the References tab.  Remove the three broken references to SixBit.API, SixBit.Business, and SixBit.Library, and then re-add the references to those files by choosing them from the installed SixBit folder.  Click Start to run the sample application to verify all references are correct.

 

 

Viewing the Source for a List Call

The source code for the calls can be found in the ExecuteManualCall sub in MainWindow.xaml.vb.  Each call is handled in a case statement.  Look for the case that handles Items_List.

Case "Items_List"

 

The first thing we do is to create a request object of type ItemsListRequestType.  This object contains all the parameters of the call.

'Build the request string from the provided parameter values.

Dim myRequest As New ItemsListRequestType   

Next, we'll set the properties of the myRequest object.  We've written a SetParameter function to do this.  It simply sets the property of myRequest based on its datatype.

 

SetParameter(myRequest.MapFilePath, "string", txtParam0)

SetParameter(myRequest.OutputFilePath, "string", txtParam1)

SetParameter(myRequest.LogFilePath, "string", txtParam2)

SetParameter(myRequest.ItemID, "string", txtParam3)

SetParameter(myRequest.ExternalItemID, "string", txtParam4)

SetParameter(myRequest.SKU, "string", txtParam5)

SetParameter(myRequest.ProductID, "string", txtParam6)

SetParameter(myRequest.CreatedFrom, "date", txtParam7)

SetParameter(myRequest.CreatedTo, "date", txtParam8)

SetParameter(myRequest.ModifiedFrom, "date", txtParam9)

SetParameter(myRequest.ModifiedTo, "date", txtParam10)

SetParameter(myRequest.ListedFrom, "date", txtParam11)

SetParameter(myRequest.ListedTo, "date", txtParam12)

SetParameter(myRequest.StartID, "integer", txtParam13)

SetParameter(myRequest.Count, "integer", txtParam14)

With all the parameters set, we simply create a myResponse object to hold the response from the call, then pass myRequest to the call.

'Make the API Call.

Dim myResponse As New ItemsListResponseType

myResponse = Items.Items_List(myRequest)

Finally, we write the response that was received to the output window.

'Write the response to the Results window.

WriteResponseToOutput(myResponse.Status)

If Not myResponse.ItemsList Is Nothing Then txtbResults.Text += vbCrLf & "Items List: " & vbCrLf & myResponse.ItemsList.ToString

 

Viewing the Source for an AddUpdate call

The source code for the calls can be found in the ExecuteManualCall sub in MainWindow.xaml.vb.  Each call is handled in a case statement.  Look for the case that handles Items_AddUpdate.

Case "Items_AddUpdate"

The first thing we do is to create a request object of type ItemsRequestType.  This object contains all the parameters of the call.

 

'Build the request string from the provided parameter values.

Dim myRequest As New ItemsRequestType

SetParameter(myRequest.Action, "integer", txtParam0)

SetParameter(myRequest.LogFilePath, "string", txtParam1)

SetParameter(myRequest.ItemTemplate, "string", txtParam2)

SetParameter(myRequest.ImportURLsAsLinks, "boolean", txtParam3)

SetParameter(myRequest.ReplaceExistingPictures, "boolean", txtParam4)

SetParameter(myRequest.UpdateRunningListings, "boolean", txtParam5)

 

XML parameters must be converted from text into an XDocument before being added to the request.

If Not String.IsNullOrEmpty(txtParam6.Text) Then

Try

   Dim myXDoc As XDocument = XDocument.Parse(txtParam6.Text)

      myRequest.XML = myXDoc

 

Create a response object and pass the request to the Items_AddUpdate call...

 

   'Make the API Call.

   Dim myResponses As New List(Of ItemsResponseType)

   myResponses = Items.Items_AddUpdate(myRequest)

 

Adding and Updating can include actions on multiple items, each with its own response.  Loop through the responses and put the results in the Results window.

 

   'Write the response to the Results window.

   For Each response In myResponses

       WriteResponseToOutput(response.Status)

   Next

Catch ex As Exception

   MsgBox("Could not load XML. No operation performed." & vbCrLf & ex.Message)

End Try

Else

   MsgBox("Missing XML parameter. No operation performed.")

End If